package com.xz.office.controller;


import org.springframework.stereotype.Controller;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.servlet.http.HttpServletRequest;
/**
 * @program: office
 * @description:
 * @author: Shawn
 * @create: 2020-11-16 09:00
 **/
@Controller
public class ViewController {

    // 通用的访问页面控制器
    @RequestMapping("/{path}.html")
    public String view(HttpServletRequest request, @PathVariable("path") String path) {
        System.out.println(path);
        request.setAttribute("name", "Thymeleaf控制器传参接收成功");
        if(StringUtils.isEmpty(path)){
            return "index";
        }else{
            return path;
        }
    }

}